package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/**
 *
 */
public class PWDemo2 {
    public static void main(String[] args) throws Exception {
        FileOutputStream fos = new FileOutputStream("hw1.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);
        Scanner sc = new Scanner(System.in);



        while (true){
            System.out.println("请输入：");
            String s = sc.next();
            if ("exit".equals(s)){
                break;
            }
            pw.println(s);

        }

        pw.close();

    }
}
